UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5JcvUB+DNzMV7f00WRLOkCxa+HCZzA1flS+gB457YTE=' 
WHERE 
  key_id = 'b9a98bfd1f0a0f0c1cf72dc5cd9e137f155bbe64342eaf767855cfa77acc6271' 
  AND (
    token = '5JcvUB+DNzMV7f00WRLOkCxa+HCZzA1flS+gB457YTE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036