UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0mHwqmRfx17wivxEdrqTLtvvXsmlUfEXlybEIag4is=' 
WHERE 
  key_id = 'd80fd915872c2017ab2ea6ab8d157b7dc71945282ce883078e7d4ae588340d60' 
  AND (
    token = 'l0mHwqmRfx17wivxEdrqTLtvvXsmlUfEXlybEIag4is=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024