UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'koRrxhnvEsX/V4Wn1VS1ujbEmk83ngvrSrE9vxad75Y=' 
WHERE 
  key_id = 'bb66f16392aa931620432cd5471faf777ab9f5cc394b8feafa54779298effe59' 
  AND (
    token = 'koRrxhnvEsX/V4Wn1VS1ujbEmk83ngvrSrE9vxad75Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052