UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3irGJnE8dnq7yhG+/uzmS/ZjedSDwNrJTIVWG2+Q2rY=' 
WHERE 
  key_id = '15bf0193cbf556e2910a04089b13d4ef23707c0acc61a87e8c64d3a2b67989bc' 
  AND (
    token = '3irGJnE8dnq7yhG+/uzmS/ZjedSDwNrJTIVWG2+Q2rY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046