UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z+gDNNIheGrM77qx1xKgYB77DEnUS8mA0Jqoxn1UxnY=' 
WHERE 
  key_id = 'b92ccdf483e6578b00d55913a82f187b41b1a0a03d7d628cadddfff1a26dd4a5' 
  AND (
    token = 'z+gDNNIheGrM77qx1xKgYB77DEnUS8mA0Jqoxn1UxnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025