UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BtNCWLb/PEimZe3pBqVm0OGPYEMkbxuk9ljt2Xs4Asw=' 
WHERE 
  key_id = '249bd279c7c452e4986a88c9ecfc495e951fe2d6a704a121f26fb96189f181d7' 
  AND (
    token = 'BtNCWLb/PEimZe3pBqVm0OGPYEMkbxuk9ljt2Xs4Asw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029